Class ResourceController

Summary

Fully Qualified Name: CodeIgniter\RESTful\ResourceController
Extends: Controller

Description

An extendable controller to provide a RESTful API for a resource.

Methods

Name Description Defined By
create() Create a new resource object, from "posted" parameters ResourceController
delete() Delete the designated resource object from the model ResourceController
edit() Return the editable properties of a resource object ResourceController
index() Return an array of resource objects, themselves in array format ResourceController
initController() ResourceController
new() Return a new resource object, with default properties ResourceController
setFormat() Set/change the expected response representation for returned objects ResourceController
setModel() Set or change the model this controller is bound to. ResourceController
show() Return the properties of a resource object ResourceController
update() Add or update a model resource, from "posted" properties ResourceController

Method Details

create()

Create a new resource object, from "posted" parameters

Returns: array an array

delete()

Delete the designated resource object from the model

Parameter Name Type Description
$id

Returns: array an array

edit()

Return the editable properties of a resource object

Parameter Name Type Description
$id

Returns: array an array

index()

Return an array of resource objects, themselves in array format

Returns: array an array

initController()

Parameter Name Type Description
$request
$response
$logger

Returns: void

new()

Return a new resource object, with default properties

Returns: array an array

setFormat()

Set/change the expected response representation for returned objects

Parameter Name Type Description
$format string

Returns:

setModel()

Set or change the model this controller is bound to.

Given either the name or the object, determine the other.

Parameter Name Type Description
$which string|object

Returns:

show()

Return the properties of a resource object

Parameter Name Type Description
$id

Returns: array an array

update()

Add or update a model resource, from "posted" properties

Parameter Name Type Description
$id

Returns: array an array

Top